#pragma once
#include <QWidget>
#include "plugindbtablemag_global.h"

class QPushButton;
class QTreeWidget;
class QLineEdit;
class QComboBox;
class QTabWidget;
class QAction;
class PLUGINDBTABLEMAG_EXPORT PluginDBTableMag : public QWidget
{
	Q_OBJECT
public:
    PluginDBTableMag(QWidget* parent = nullptr);
	virtual ~PluginDBTableMag();

	static PluginDBTableMag* GetInstance(QWidget* parent = nullptr);

protected:
	void InitUI();
	void InitAction();
	void InitListHeader();
	void InitCmbCtrlData();

	static PluginDBTableMag* _instance;
	QWidget* createScriptWidget();
	QWidget* createLocalWidget();

private:
	QWidget* _scriptWidget = nullptr;
	QWidget* _localWidget = nullptr;
	QTabWidget* _tabWidget = nullptr;
	QTreeWidget* _treeWidgetNew = nullptr;
	QTreeWidget* _treeWidgetExist = nullptr;
	QPushButton* _pBtnClearNew = nullptr;
	QPushButton* _pBtnCreateNewTable = nullptr;
	QPushButton* _pBtnQuery = nullptr;
	QPushButton* _pBtnDelTable = nullptr;
	QPushButton* _pBtnUpdateTable = nullptr;
	QLineEdit* _editTableName = nullptr;
	QLineEdit* _edtiKeys = nullptr;
	QLineEdit* _editContent = nullptr;
	QLineEdit* _editLength = nullptr;
	QComboBox* _comboIsNULL = nullptr;
	QComboBox* _comboType = nullptr;
	QPushButton* _newTableBtn = nullptr;
	QPushButton* _newContentBtn = nullptr;
	QPushButton* _newKeyBtn = nullptr;
	QPushButton* _confirmBtn = nullptr;
	QPushButton* _cancelBtn = nullptr;
	QLineEdit* _scriptPath = nullptr;
	QPushButton* _btnSelectPath = nullptr;
	QPushButton* _btnStartDeal = nullptr;

	QAction* mActDeleteField;
	QAction* mActDeleteTable;
	QAction* mActUpdateField;
	QAction* mActUpdateKey;
	QAction* mActAddKey;
};
